package com.ajieee.merge.controller.finance;

import com.ajieee.merge.entity.common.result.ApiResult;
import com.ajieee.merge.entity.finance.dto.EtlManagerDTO;
import com.ajieee.merge.entity.finance.dto.EtlManagerRespDTO;
import com.ajieee.merge.service.EtlManagerService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 主数据管理
 *
 * @author ajieee
 * @date 2025-10-26
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/etl_manager")
public class EtlManagerController {

	private final EtlManagerService etlManagerService;

	@GetMapping("/list")
	public ApiResult<List<EtlManagerRespDTO>> list(EtlManagerDTO dto) {
		List<EtlManagerRespDTO> list = etlManagerService.list(dto);
		return ApiResult.success(list);
	}

	@PostMapping("/sync_sse_etf_his_quote")
	public ApiResult<Void> syncSseEtfQuote() {
		etlManagerService.syncSseEtfQuote();
		return ApiResult.success();
	}

	@PostMapping("/sync_szse_etf_his_quote")
	public ApiResult<Void> syncSzseEtfQuote() {
		etlManagerService.syncSzseEtfQuote();
		return ApiResult.success();
	}

}
